﻿Ext.define('GS.model.user.User', {
    extend: 'Ext.data.Model',
    config: {
        fields: [{
            name: 'id',
            type: 'int'
        }, {
            name: 'user_id',
            type: 'int'
        }, {
            name: 'email',
            type: 'string'
        }, {
            name: 'first_name',
            type: 'string',
        }, {
            name: 'last_name',
            type: 'string',
        }, {
            name: 'school_id',
            type: 'int',
        }, {
            name: 'last_login',
            type: 'date',
            dateFormat: 'c'
        }, {
            name: 'logged_in',
            type: 'bool',
        }],

        validations: [
            {type: 'presence', name: 'email', message:"Udfyld email"},
            {type: 'presence', name: 'first_name', message:"Udfyld navn"},
            {type: 'presence', name: 'last_name', message:"Udfyld efternavn"}
        ],
        
        proxy: {
            type: 'localstorage',
            id: 'user-data'
        },
    }
});